package com.yzjs.localhost.controller.tDatasourceSettings;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.yzjs.common.enumeration.RequestMethod;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import com.yzjs.common.base.entity.PageInfo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.yzjs.localhost.entity.tDatasourceSettings.TDatasourceSettingsEntity;
import com.yzjs.localhost.service.tDatasourceSettings.TDatasourceSettingsService;




/**
 * 
 *
 * @author yuqiumin
 * @email sunlightcs@gmail.com
 * @date 2021-09-07 16:05:25
 */
@Api(tags = "")
@RestController
@RequestMapping("tDatasourceSettings")
public class TDatasourceSettingsController {
    @Autowired
    private TDatasourceSettingsService tDatasourceSettingsService;




    /**
     * 信息
     */
    @ApiOperation(value="信息" ,httpMethod =RequestMethod.GET )
    @RequestMapping("/info")
    public TDatasourceSettingsEntity info( @RequestParam(required = true)   Integer id){
        TDatasourceSettingsEntity  query = new TDatasourceSettingsEntity();
        query.setId(id);
        TDatasourceSettingsEntity tDatasourceSettings = tDatasourceSettingsService.findOne(query);
        return  tDatasourceSettings ;
    }
    /**
    * 列表查询
    * @return
    */
    @ApiOperation(value="列表查询" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/list")
    public List<TDatasourceSettingsEntity> List( @RequestBody TDatasourceSettingsEntity tDatasourceSettings) {

        List<TDatasourceSettingsEntity> tDatasourceSettingss = tDatasourceSettingsService.findList(tDatasourceSettings);
        return tDatasourceSettingss;
    }


    /**
     * 分页查询
     * @param tDatasourceSettings
     * @return
     */
    @ApiOperation(value="分页查询" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/listPage")
    public PageInfo<TDatasourceSettingsEntity> listPage(@RequestBody TDatasourceSettingsEntity tDatasourceSettings) {
        List<TDatasourceSettingsEntity> tDatasourceSettingss  = tDatasourceSettingsService.findList(tDatasourceSettings);
        return new PageInfo<>(tDatasourceSettingss ,tDatasourceSettings);
    }


    /**
     * 保存
     */
    @ApiOperation(value="保存" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/save")
    public TDatasourceSettingsEntity save(@RequestBody TDatasourceSettingsEntity tDatasourceSettings){
		tDatasourceSettingsService.insert(tDatasourceSettings);
        return tDatasourceSettings;
    }

    /**
     * 修改
     */
    @ApiOperation(value="修改" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/update")
    public TDatasourceSettingsEntity update(@RequestBody TDatasourceSettingsEntity tDatasourceSettings){
		tDatasourceSettingsService.update(tDatasourceSettings);
        return tDatasourceSettings;
    }

    /**
     * 删除
     */
    @ApiOperation(value="删除" ,httpMethod =RequestMethod.DELETE )
    @RequestMapping("/delete")
    public TDatasourceSettingsEntity  delete( @RequestParam(required = true)  Integer id){
        TDatasourceSettingsEntity  delete  = new TDatasourceSettingsEntity();
        delete.setId(id);
        tDatasourceSettingsService.delete(delete);
        return delete;
    }

}
